#pragma once
#include "MutexBuffer.h"
#include "SoundPlay.h"
#include "SoundCapture.h"
#include <dsound.h>

namespace ipsound {

class SoundDuplex
{
public:
	SoundDuplex( MutexBuffer* readBuf, MutexBuffer* writeBuf, HWND window );
	size_t GetMinimumPlaySize();
	void StartCapture();
	void StartPlay();
	~SoundDuplex();
private:
	MutexBuffer* readBuf;
	MutexBuffer* writeBuf;
	SoundPlay* soundPlay;
	SoundCapture* soundCapture;
	LPDIRECTSOUNDCAPTUREBUFFER8 captureBuf8;	
	LPDIRECTSOUNDBUFFER8 playBuf8;
	LPDIRECTSOUNDFULLDUPLEX8 duplex8;
	unsigned short channelsNum, bitsPerSample;
	unsigned long samplesPerSec;
	unsigned short playBufSec, captureBufSec;
	unsigned short notifySamplesNum;
};

}